package com.yunhe.spring.service.impl;

import com.yunhe.spring.dao.StudentDao;
import com.yunhe.spring.entity.Student;
import com.yunhe.spring.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation= Propagation.REQUIRED)
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;

    @Override
    public void save(Student student) {
        studentDao.save(student);
    }

    @Override
    public void remove(Integer id) {
        studentDao.remove(id);
    }

    @Override
    public Student findById(Integer id) {


        return studentDao.findById(id);
    }

    @Override
    public List<Student> findAll() {

        return   studentDao.findAll();
    }
}
